<template>
	<view>
		<view class="page">
			<view class="example-body">
				<uni-nav-bar background-color="#003466" color="#ffffff" :status-bar="true" @click-left="back" left-icon="arrowleft">
					<view class="flex-item">物资管理</view>
				</uni-nav-bar>
			</view>
			<view>
				<!-- <uni-segmented-control :current="current" :values="items" @clickItem="onClickItem" style-type="text"></uni-segmented-control> -->
				<view id="manage-container" class="content">
					<view class="man-option option_active">
						<view class="jbinformation">
							<view class="inf-option">
								<view class="inf-one">物资品类</view>
								<view class="inf-two">{{ objData.name }}</view>
							</view>
							<view class="inf-option">
								<view class="inf-one">规格</view>
								<view class="inf-two">{{ objData.specification }}</view>
							</view>
							<view class="inf-option">
								<view class="inf-one">存放位置</view>
								<view class="inf-two">{{ objData.roomRowGuid }}</view>
							</view>
							<view class="inf-option">
								<view class="inf-one">单位</view>
								<view class="inf-two">{{ objData.unit }}</view>
							</view>
							<view class="inf-option">
								<view class="inf-one">库存预警阈值</view>
								<view class="inf-two">{{ objData.threshold }}</view>
							</view>
						</view>
					</view>
					<!-- <view v-show="current === 1" class="view-top">
						<view class="man-option man-collaps">
							<uni-collapse>
								<uni-collapse-item title="单号:201907291143         时间:2019-06-15 12:35" class="top-collapse">
									<view class="view-container">
										<view class="container-left">
											<view class="view-lb">超五类网线</view>
											<view class="view-sl">数量：50</view>
										</view>
										<view class="container-right">入库</view>
									</view>
									<view class="view-container">
										<view class="container-left">
											<view class="view-lb">超五类网线</view>
											<view class="view-sl">数量：50</view>
										</view>
										<view class="container-right new-conright">出库</view>
									</view>
									<view class="view-container">
										<view class="container-left">
											<view class="view-lb">超五类网线</view>
											<view class="view-sl">数量：50</view>
										</view>
										<view class="container-right new-conright">出库</view>
									</view>
								</uni-collapse-item>
							</uni-collapse>
							<uni-collapse>
								<uni-collapse-item title="单号:201907291143         时间:2019-06-15 12:35">
									<view class="view-container">
										<view class="container-left">
											<view class="view-lb">超五类网线</view>
											<view class="view-sl">数量：50</view>
										</view>
										<view class="container-right">入库</view>
									</view>
									<view class="view-container">
										<view class="container-left">
											<view class="view-lb">超五类网线</view>
											<view class="view-sl">数量：50</view>
										</view>
										<view class="container-right new-conright">出库</view>
									</view>
									<view class="view-container">
										<view class="container-left">
											<view class="view-lb">超五类网线</view>
											<view class="view-sl">数量：50</view>
										</view>
										<view class="container-right new-conright">出库</view>
									</view>
								</uni-collapse-item>
							</uni-collapse>
						</view>
					</view> -->
					<!-- <view v-show="current === 2" class="view-top">
						<view class="man-option">
							<view class="man-option">
								<view class="pdinf">
									<view class="jbinformation">
										<view class="inf-option"><view class="inf-one big-one">螺丝钉</view></view>
										<view class="inf-option">
											<view class="inf-one">账存数</view>
											<view class="inf-two">20</view>
										</view>
										<view class="inf-option">
											<view class="inf-one">实存数</view>
											<view class="inf-two">20</view>
										</view>
										<view class="inf-option">
											<view class="inf-one">盘点时间</view>
											<view class="inf-two">2019-07-06 09:54</view>
										</view>
										<view class="inf-option">
											<view class="inf-one">盘点人</view>
											<view class="inf-two">Admin</view>
										</view>
										<view class="inf-option">
											<view class="inf-one">备注</view>
											<view class="inf-two">暂无备注</view>
										</view>
									</view>
									<view class="jbinformation">
										<view class="inf-option"><view class="inf-one big-one">螺丝钉</view></view>
										<view class="inf-option">
											<view class="inf-one">账存数</view>
											<view class="inf-two">20</view>
										</view>
										<view class="inf-option">
											<view class="inf-one">实存数</view>
											<view class="inf-two">20</view>
										</view>
										<view class="inf-option">
											<view class="inf-one">盘点时间</view>
											<view class="inf-two">2019-07-06 09:54</view>
										</view>
										<view class="inf-option">
											<view class="inf-one">盘点人</view>
											<view class="inf-two">Admin</view>
										</view>
										<view class="inf-option">
											<view class="inf-one">备注</view>
											<view class="inf-two">暂无备注</view>
										</view>
									</view>
								</view>
							</view>
						</view>
					</view> -->
				</view>
			</view>
		</view>
	</view>
</template>

<script>
import uniCollapse from '@/components/uni-collapse/uni-collapse.vue';
import uniCollapseItem from '@/components/uni-collapse-item/uni-collapse-item.vue';
import uniList from '@/components/uni-list/uni-list.vue';
import uniListItem from '@/components/uni-list-item/uni-list-item.vue';
import uniSegmentedControl from '@/components/uni-segmented-control/uni-segmented-control.vue';
import uniNavBar from '@/components/uni-nav-bar/uni-nav-bar.vue';
import uniIcon from '@/components/uni-icon/uni-icon.vue';
// 引入组件 uni-load-more.vue
import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
import tools from '@/common/tools-new.js'

export default {
	components: {
		uniCollapse,
		uniCollapseItem,
		uniList,
		uniListItem,
		uniSegmentedControl,
		uniNavBar,
		uniIcon
	},
	data() {
		return {
			// items: ['基本信息'],
			current: 0,
			//列表分页数据源
			listData: [],

			//加载方式文字提示
			contentText: {
				contentdown: '上拉显示更多',
				contentrefresh: '正在加载...',
				contentnomore: '没有更多数据了'
			},
			objData: [], //详情获取

			objInf: [] //房间获取
		};
	},
	methods: {
		//初始化房间数据
		getOptionList(id) {
			let param = { id: id };
			this.$api.SupplyManage.GetOptionInf(param)
				.then(res => {
					this.objData = res[1].data.result;
					console.log(this.objData.roomRowGuid);
					this.objData.roomRowGuid =
						this.objInf.find(e => e.id == this.objData.roomRowGuid) == undefined ? '--' : this.objInf.find(e => e.id == this.objData.roomRowGuid).roomName;
				
				})
				.catch(res => {
					//接口请求失败
					uni.showToast({
						title: '接口数据请求失败',
						duration: 2000
					});
				});
		},

		//初始化房间数据
		getRommList() {
			this.$api.SupplyManage.GetRoomName()
				.then(res => {
					this.objInf = res[1].data.result;
					console.log(this.objInf);
				})
				.catch(res => {
					uni.showToast({
						title: '处理对象获取失败',
						duration: 2000
					});
				});
		},

		change(e) {
			console.log(e);
		},
		onClickItem(index) {
			if (this.current !== index) {
				this.current = index;
			}
		},
		back() {
			uni.navigateBack({
				delta: 1
			});
		}
	},
	/**
	 * 初次加载数据
	 * */
	onLoad: async function(option) {
		await this.getRommList();
		this.getOptionList(option.id);
	}
};
</script>

<style>
page {
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
	background-color: #F2F2F2;
}

.flex-item {
	font-size: 20px;
	text-align: center;
}

.uni-icon {
	padding-left: 42%;
}

.uni-navbar__header-btns {
	padding: 0;
	margin-left: 14px;
}

.uni-navbar__header-btns:last-child {
	width: 120px;
}

#manage-top {
	width: 94%;
	height: 47px;
	margin: 0 auto;
	display: flex;
	justify-content: center;
}

#manage-top view {
	width: 33.33333%;
	font-size: 14px;
	color: #333333;
	text-align: center;
	line-height: 47px;
}

#manage-container .view-top {
	margin-top: 60px;
}

#manage-container .jbinformation {
	width: 94%;
	background-color: #ffffff;
	font-size: 16px;
	margin: 0 auto;
	margin-top: 10px;
	overflow: hidden;
}

.jbinformation .inf-option {
	width: 94%;
	border-bottom: 1px solid #e5e5e5;
	margin: 0 auto;
	overflow: hidden;
	padding: 16px 0px;
}

.inf-option .inf-one {
	color: #999999;
	float: left;
}

.inf-option .inf-two {
	color: #333333;
	float: right;
}

.pdinf .big-one {
	color: #000000;
}

#manage-container .man-collaps {
	width: 100%;
	margin: 0 auto;
}

.uni-collapse-cell--hover {
	background: #ffffff;
}

.uni-collapse-cell--open {
	background: #ffffff;
}

.uni-collapse-cell__title-text {
	font-size: 14px;
}

.uni-collapse-cell__title {
	border-bottom: 1px solid #efefef;
	color: #666666;
}

.man-collaps .view-container {
	width: 92%;
	border-bottom: 1px solid #efefef;
	margin: 0 auto;
	padding: 15px 0px 15px 0px;
	font-size: 12px;
	overflow: hidden;
}

.view-container .container-left {
	float: left;
}

.view-container .container-right {
	width: 40px;
	height: 25px;
	background: #20bef2;
	font-size: 11px;
	text-align: center;
	line-height: 24px;
	color: #ffffff;
	float: right;
	margin: 2.5% 0px 0px;
}

.uni-icon {
	padding: 0;
}

.view-container .new-conright {
	background: #0cd47d;
}

.container-left .view-lb {
	font-size: 16px;
	color: #333333;
}

.container-left .view-sl {
	font-size: 14px;
	color: #999999;
	margin-top: 8px;
}

.segmented-control {
	width: 100%;
	height: 40px;
	line-height: 37px;
	font-size: 16px;
	text-align: center;
	background-color: #f2f2f2;
	border: none;
	border-radius: none;
	position: fixed;
	left: 0;
	right: 0;
	top: 75px;
	padding-left: 3%;
	padding-right: 3%;
	z-index: 11;
}

.segmented-control-item {
	line-height: 30px;
}

.segmented-control-item {
	border: none;
}

.segmented-control-item.active {
	color: #458cd0;
}

.uni-collapse {
	margin-top: 10px;
}

.segmented-control-item.text.active {
	border-bottom-style: #458cd0;
}
</style>
